<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>Reference</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>Duplex</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>


<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../modules/Duplex.Application.html">Duplex.Application</a></li>
  <li><a href="../modules/Duplex.Applications.Effect.html">Duplex.Applications.Effect</a></li>
  <li><a href="../modules/Duplex.Applications.GridPie.html">Duplex.Applications.GridPie</a></li>
  <li><a href="../modules/Duplex.Applications.Hydra.html">Duplex.Applications.Hydra</a></li>
  <li><a href="../modules/Duplex.Applications.Instrument.html">Duplex.Applications.Instrument</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.GridLayout.html">Duplex.Applications.Keyboard.GridLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.HarmonicLayout.html">Duplex.Applications.Keyboard.Layouts.HarmonicLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.IsomorphicLayout.html">Duplex.Applications.Keyboard.Layouts.IsomorphicLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.PianoLayout.html">Duplex.Applications.Keyboard.Layouts.PianoLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.html">Duplex.Applications.Keyboard</a></li>
  <li><a href="../modules/Duplex.Applications.Matrix.html">Duplex.Applications.Matrix</a></li>
  <li><a href="../modules/Duplex.Applications.Metronome.html">Duplex.Applications.Metronome</a></li>
  <li><a href="../modules/Duplex.Applications.MidiActions.Bindings.html">Duplex.Applications.MidiActions.Bindings</a></li>
  <li><a href="../modules/Duplex.Applications.MidiActions.html">Duplex.Applications.MidiActions</a></li>
  <li><a href="../modules/Duplex.Applications.Mixer.html">Duplex.Applications.Mixer</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_group.html">Duplex.Applications.Mlrx.Mlrx_group</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_note.html">Duplex.Applications.Mlrx.Mlrx_note</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_pos.html">Duplex.Applications.Mlrx.Mlrx_pos</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_track.html">Duplex.Applications.Mlrx.Mlrx_track</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.html">Duplex.Applications.Mlrx</a></li>
  <li><a href="../modules/Duplex.Applications.Navigator.html">Duplex.Applications.Navigator</a></li>
  <li><a href="../modules/Duplex.Applications.NotesOnWheels.html">Duplex.Applications.NotesOnWheels</a></li>
  <li><a href="../modules/Duplex.Applications.PatternCursor.html">Duplex.Applications.PatternCursor</a></li>
  <li><a href="../modules/Duplex.Applications.PatternSequence.html">Duplex.Applications.PatternSequence</a></li>
  <li><a href="../modules/Duplex.Applications.Recorder.html">Duplex.Applications.Recorder</a></li>
  <li><a href="../modules/Duplex.Applications.Repeater.html">Duplex.Applications.Repeater</a></li>
  <li><a href="../modules/Duplex.Applications.Rotate.html">Duplex.Applications.Rotate</a></li>
  <li><a href="../modules/Duplex.Applications.StepSequencer.html">Duplex.Applications.StepSequencer</a></li>
  <li><a href="../modules/Duplex.Applications.SwitchConfiguration.html">Duplex.Applications.SwitchConfiguration</a></li>
  <li><a href="../modules/Duplex.Applications.TestPad.html">Duplex.Applications.TestPad</a></li>
  <li><a href="../modules/Duplex.Applications.TrackSelector.html">Duplex.Applications.TrackSelector</a></li>
  <li><a href="../modules/Duplex.Applications.Transport.html">Duplex.Applications.Transport</a></li>
  <li><a href="../modules/Duplex.Applications.UIButtonTest.html">Duplex.Applications.UIButtonTest</a></li>
  <li><a href="../modules/Duplex.Applications.XYPad.html">Duplex.Applications.XYPad</a></li>
  <li><a href="../modules/Duplex.Automation.html">Duplex.Automation</a></li>
  <li><a href="../modules/Duplex.Browser.html">Duplex.Browser</a></li>
  <li><a href="../modules/Duplex.BrowserProcess.html">Duplex.BrowserProcess</a></li>
  <li><a href="../modules/Duplex.Canvas.html">Duplex.Canvas</a></li>
  <li><a href="../modules/Duplex.CanvasPoint.html">Duplex.CanvasPoint</a></li>
  <li><a href="../modules/Duplex.ControlMap.html">Duplex.ControlMap</a></li>
  <li><a href="../modules/Duplex.Device.html">Duplex.Device</a></li>
  <li><a href="../modules/Duplex.Display.html">Duplex.Display</a></li>
  <li><a href="../modules/Duplex.Globals.html">Duplex.Globals</a></li>
  <li><a href="../modules/Duplex.Message.html">Duplex.Message</a></li>
  <li><a href="../modules/Duplex.MessageStream.html">Duplex.MessageStream</a></li>
  <li><a href="../modules/Duplex.MidiDevice.html">Duplex.MidiDevice</a></li>
  <li><a href="../modules/Duplex.OscClient.html">Duplex.OscClient</a></li>
  <li><strong>Duplex.OscDevice</strong></li>
  <li><a href="../modules/Duplex.OscVoiceMgr.html">Duplex.OscVoiceMgr</a></li>
  <li><a href="../modules/Duplex.Preferences.html">Duplex.Preferences</a></li>
  <li><a href="../modules/Duplex.ProcessSlicer.html">Duplex.ProcessSlicer</a></li>
  <li><a href="../modules/Duplex.RoamingDSP.html">Duplex.RoamingDSP</a></li>
  <li><a href="../modules/Duplex.Scheduler.html">Duplex.Scheduler</a></li>
  <li><a href="../modules/Duplex.StateController.html">Duplex.StateController</a></li>
  <li><a href="../modules/Duplex.UIButton.html">Duplex.UIButton</a></li>
  <li><a href="../modules/Duplex.UIButtonStrip.html">Duplex.UIButtonStrip</a></li>
  <li><a href="../modules/Duplex.UIComponent.html">Duplex.UIComponent</a></li>
  <li><a href="../modules/Duplex.UIKey.html">Duplex.UIKey</a></li>
  <li><a href="../modules/Duplex.UIKeyPressure.html">Duplex.UIKeyPressure</a></li>
  <li><a href="../modules/Duplex.UILabel.html">Duplex.UILabel</a></li>
  <li><a href="../modules/Duplex.UIPad.html">Duplex.UIPad</a></li>
  <li><a href="../modules/Duplex.UIPitchBend.html">Duplex.UIPitchBend</a></li>
  <li><a href="../modules/Duplex.UISlider.html">Duplex.UISlider</a></li>
  <li><a href="../modules/Duplex.UISpinner.html">Duplex.UISpinner</a></li>
  <li><a href="../modules/Duplex.WidgetHooks.html">Duplex.WidgetHooks</a></li>
  <li><a href="../modules/Duplex.WidgetKeyboard.html">Duplex.WidgetKeyboard</a></li>
  <li><a href="../modules/Duplex.html">Duplex</a></li>
  <li><a href="../modules/main.html">main</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>Duplex.OscDevice</code></h1>
<p>A generic OSC device class, providing the ability to send and receive OSC.</p>
<p>



<h3>Changes</h3>

<p>  0.99.3</p>
<pre><code>- Ability to dump OSC message to console (just like MIDI messages)
- Feedback prevention: optionally block messages that appear to be echoed back
</code></pre>

<p>  0.99.2</p>
<pre><code>- strip non-ascii character from text before sending
- "pattern captures" - reconstruct when sending outgoing OSC message
</code></pre>

<p>  0.98.27</p>
<pre><code>- support text values
</code></pre>

<p>  0.98.14  </p>
<pre><code>- optional, per-device message bundling (for example, TouchOSC)
  ..no more lost messages on wireless devices?
</code></pre>

<p>  0.9</p>
<pre><code>- First release
</code></pre>


</p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#__init">__init (name, message_stream, prefix, address, port_in, port_out)</a></td>
	<td class="summary">Initialize OSCDevice class</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#open">open ()</a></td>
	<td class="summary">Create the OSC client/server sockets, set prefix (if any)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#socket_error">socket_error (error_message)</a></td>
	<td class="summary">An error happened in the servers background thread (this should not happen)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#socket_message">socket_message (socket, binary_data)</a></td>
	<td class="summary">Receive/unpack osc messages - this is a low-level method which will receive
 incoming messages and translate them into a text representation</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#receive_osc_message">receive_osc_message (value_str)</a></td>
	<td class="summary">Look up value, once we have unpacked the message</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#release">release ()</a></td>
	<td class="summary">Release the device</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#set_device_prefix">set_device_prefix (prefix)</a></td>
	<td class="summary">Set prefix for this device (a pattern which is appended to all outgoing
 traffic, and also act as a filter for incoming messages)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#queue_osc_message">queue_osc_message (message, value)</a></td>
	<td class="summary">Queue a message instead of sending it right away.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#on_idle">on_idle ()</a></td>
	<td class="summary">Bundle &amp; send queued messages</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#send_osc_bundle">send_osc_bundle ()</a></td>
	<td class="summary">Send a queued bundle of OSC messages</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#send_osc_message">send_osc_message (message, value)</a></td>
	<td class="summary">Send a OSC message right away.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#_construct_osc_message">_construct_osc_message (message, value)</a></td>
	<td class="summary">Construct OSC message (used by <a href="../modules/Duplex.OscDevice.html#send_osc_message">send_osc_message</a> &amp; <a href="../modules/Duplex.OscDevice.html#send_osc_bundle">send_osc_bundle</a>)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#_unpack_messages">_unpack_messages (message_or_bundle, messages)</a></td>
	<td class="summary">Recursively unpacks all OSC messages from the given bundle or message.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#_produce_entry">_produce_entry (vars, value)</a></td>
	<td class="summary">Produce an OSC message value entry (utilized by <a href="../modules/Duplex.OscDevice.html#_construct_osc_message">_construct_osc_message</a>).</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#_msg_to_string">_msg_to_string (msg)</a></td>
	<td class="summary">Create string representation of OSC message:
 e.g.</td>
	</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#self.prefix">self.prefix</a></td>
	<td class="summary">(string) optional device prefix, e.g.</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.address">self.address</a></td>
	<td class="summary">(address) can be an IP address or a domain</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.port_in">self.port_in</a></td>
	<td class="summary">(int) the port where incoming messages arrive</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.port_out">self.port_out</a></td>
	<td class="summary">(int) the port where outgoing messages leave</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.bundle_messages">self.bundle_messages</a></td>
	<td class="summary">(bool) whether we should bundle OSC messages (true) or not (false).</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.client">self.client</a></td>
	<td class="summary">(renoise.Socket.SocketClient)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.server">self.server</a></td>
	<td class="summary">(renoise.Socket.SocketServer)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#self.message_queue">self.message_queue</a></td>
	<td class="summary">(table) containing queued messages.</td>
	</tr>
</table>

<br/>
<br/>


    <h2><a name="Functions"></a>Functions</h2>
    <dl class="function">
    <dt>
    <a name = "__init"></a>
    <strong>__init (name, message_stream, prefix, address, port_in, port_out)</strong>
    </dt>
    <dd>
    Initialize OSCDevice class


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">name</span>
         (string) the friendly name of the device
        </li>
        <li><span class="parameter">message_stream</span>
         (<a href="../modules/Duplex.MessageStream.html#">Duplex.MessageStream</a>) the msg-stream we should attach to
        </li>
        <li><span class="parameter">prefix</span>
         (string) the OSC prefix to use
        </li>
        <li><span class="parameter">address</span>
         (string) the OSC address (can be an IP address)
        </li>
        <li><span class="parameter">port_in</span>
         (int) the OSC input port
        </li>
        <li><span class="parameter">port_out</span>
         (int) the OSC output port
        </li>
    </ul>





</dd>
    <dt>
    <a name = "open"></a>
    <strong>open ()</strong>
    </dt>
    <dd>
    Create the OSC client/server sockets, set prefix (if any)







</dd>
    <dt>
    <a name = "socket_error"></a>
    <strong>socket_error (error_message)</strong>
    </dt>
    <dd>
    An error happened in the servers background thread (this should not happen)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">error_message</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "socket_message"></a>
    <strong>socket_message (socket, binary_data)</strong>
    </dt>
    <dd>
    Receive/unpack osc messages - this is a low-level method which will receive
 incoming messages and translate them into a text representation


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">socket</span>
         (a "dummy" socket, contains socket.port and socket.address)
        </li>
        <li><span class="parameter">binary_data</span>
         (raw, packetized socket data)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "receive_osc_message"></a>
    <strong>receive_osc_message (value_str)</strong>
    </dt>
    <dd>
    Look up value, once we have unpacked the message


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">value_str</span>
         (string), control-map string
        </li>
    </ul>





</dd>
    <dt>
    <a name = "release"></a>
    <strong>release ()</strong>
    </dt>
    <dd>
    Release the device







</dd>
    <dt>
    <a name = "set_device_prefix"></a>
    <strong>set_device_prefix (prefix)</strong>
    </dt>
    <dd>
    Set prefix for this device (a pattern which is appended to all outgoing
 traffic, and also act as a filter for incoming messages)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">prefix</span>
         (string)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "queue_osc_message"></a>
    <strong>queue_osc_message (message, value)</strong>
    </dt>
    <dd>
    Queue a message instead of sending it right away.  Some devices need data
 to arrive in fewer packets due to network conditions


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">message</span>
         (string) the message string
        </li>
        <li><span class="parameter">value</span>
         (number, string or table) the value(s) to inject
        </li>
    </ul>





</dd>
    <dt>
    <a name = "on_idle"></a>
    <strong>on_idle ()</strong>
    </dt>
    <dd>
    Bundle &amp; send queued messages







</dd>
    <dt>
    <a name = "send_osc_bundle"></a>
    <strong>send_osc_bundle ()</strong>
    </dt>
    <dd>
    Send a queued bundle of OSC messages





    <h3>See also:</h3>
    <ul>
         <a href="../modules/Duplex.OscDevice.html#queue_osc_message">OscDevice:queue_osc_message</a>
    </ul>


</dd>
    <dt>
    <a name = "send_osc_message"></a>
    <strong>send_osc_message (message, value)</strong>
    </dt>
    <dd>
    Send a OSC message right away.  This is the method being used by the
 Display for updating the visual state of device


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">message</span>
         (string) the message string, e.g. "/device/button %i"
        </li>
        <li><span class="parameter">value</span>
         (number or table) the value(s) to inject
        </li>
    </ul>





</dd>
    <dt>
    <a name = "_construct_osc_message"></a>
    <strong>_construct_osc_message (message, value)</strong>
    </dt>
    <dd>
    Construct OSC message (used by <a href="../modules/Duplex.OscDevice.html#send_osc_message">send_osc_message</a> &amp; <a href="../modules/Duplex.OscDevice.html#send_osc_bundle">send_osc_bundle</a>)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">message</span>
         (string) the message string, e.g. "/device/button %i"
        </li>
        <li><span class="parameter">value</span>
         (number or table) the value(s) to inject
        </li>
    </ul>





</dd>
    <dt>
    <a name = "_unpack_messages"></a>
    <strong>_unpack_messages (message_or_bundle, messages)</strong>
    </dt>
    <dd>
    Recursively unpacks all OSC messages from the given bundle or message. <br/>
 when message<em>or</em>bundle is a single message, only this one will be added
 to the given message list


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">message_or_bundle</span>
         (renoise.Osc.Message or renoise.Osc.Bundle)
        </li>
        <li><span class="parameter">messages</span>
         (table) table to insert unpacked messages into
        </li>
    </ul>





</dd>
    <dt>
    <a name = "_produce_entry"></a>
    <strong>_produce_entry (vars, value)</strong>
    </dt>
    <dd>
    Produce an OSC message value entry (utilized by <a href="../modules/Duplex.OscDevice.html#_construct_osc_message">_construct_osc_message</a>). </p>

<p> Note that if only "vars" is defined, it will be treated as a standalone
 floating-point value. Otherwise, "vars" will indicate the type of value


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">vars</span>

<p> (number or string), value or the type of value</p>
<pre><code>"%i" = integer number
"%f" = floating-point
"%s" = string (ascii)
</code></pre>

        </li>
        <li><span class="parameter">value</span>
         (number)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "_msg_to_string"></a>
    <strong>_msg_to_string (msg)</strong>
    </dt>
    <dd>
    Create string representation of OSC message:
 e.g.  "/this/is/the/pattern 1 2 3"


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">msg</span>
         (renoise.Osc.Message)
        </li>
    </ul>





</dd>
</dl>
    <h2><a name="Fields"></a>Fields</h2>
    <dl class="function">
    <dt>
    <a name = "self.prefix"></a>
    <strong>self.prefix</strong>
    </dt>
    <dd>
    (string) optional device prefix, e.g.  "/duplex"







</dd>
    <dt>
    <a name = "self.address"></a>
    <strong>self.address</strong>
    </dt>
    <dd>
    (address) can be an IP address or a domain







</dd>
    <dt>
    <a name = "self.port_in"></a>
    <strong>self.port_in</strong>
    </dt>
    <dd>
    (int) the port where incoming messages arrive







</dd>
    <dt>
    <a name = "self.port_out"></a>
    <strong>self.port_out</strong>
    </dt>
    <dd>
    (int) the port where outgoing messages leave







</dd>
    <dt>
    <a name = "self.bundle_messages"></a>
    <strong>self.bundle_messages</strong>
    </dt>
    <dd>
    (bool) whether we should bundle OSC messages (true) or not (false).
 Enable this feature if you experience lost packets, and/or is using
 devices that communicate over wireless networks (see TouchOSC class)







</dd>
    <dt>
    <a name = "self.client"></a>
    <strong>self.client</strong>
    </dt>
    <dd>
    (renoise.Socket.SocketClient)







</dd>
    <dt>
    <a name = "self.server"></a>
    <strong>self.server</strong>
    </dt>
    <dd>
    (renoise.Socket.SocketServer)







</dd>
    <dt>
    <a name = "self.message_queue"></a>
    <strong>self.message_queue</strong>
    </dt>
    <dd>

<p>(table) containing queued messages. </p>
<pre><code>[1] = {
  message = (string) -- e.g. "/device/button %i"
  value = (number or table) -- the current value
},...
</code></pre>








</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
